

namespace Stee.CAP8.MessageBus.Kafka.Models
{
    using Stee.CAP8.MessageBus.Kafka.Utility;

    /// <summary>
    /// Details about consumer group for specific topic & partition
    /// </summary>
    internal class GroupDetail
    {
        /// <summary>
        /// Gets the topic name
        /// </summary>
        internal string TopicName { get; }

        /// <summary>
        /// Gets the consumer group name
        /// </summary>
        internal string GroupName { get; }

        /// <summary>
        /// Gets the partition ID of topic
        /// </summary>
        internal int PartitionID { get; }

        /// <summary>
        /// Gets or sets the offset value in partition
        /// </summary>
        internal long Offset { get; }


        /// <summary>
        /// Initializes a new instance of the GroupDetail class
        /// </summary>
        /// <param name="topicName">Topic name</param>
        /// <param name="groupName">Consumer group name</param>
        /// <param name="partitionID">Partition ID</param>
        /// <param name="offset">Offset value</param>
        internal GroupDetail(string topicName, string groupName, int partitionID, long offset)
        {
            this.TopicName = ValidateHelper.CheckString(topicName, excpMsg: "Topic name cannot be NULL or empty.");
            this.GroupName = ValidateHelper.CheckString(groupName, excpMsg: "Consumer group name cannot be NULL or empty.");
            this.PartitionID = partitionID;
            this.Offset = offset;
        }
    }
}
